using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class WF_WorkflowMap : EntityTypeConfiguration<WF_Workflow>
    {
        public WF_WorkflowMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.ID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Code)
                .HasMaxLength(20);

            this.Property(t => t.Subject)
                .HasMaxLength(100);

            this.Property(t => t.Status)
                .IsFixedLength()
                .HasMaxLength(1);

            this.Property(t => t.Customer)
                .HasMaxLength(6);

            this.Property(t => t.TypeCode)
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("WF_Workflow");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Code).HasColumnName("Code");
            this.Property(t => t.StartDate).HasColumnName("StartDate");
            this.Property(t => t.EndDate).HasColumnName("EndDate");
            this.Property(t => t.Subject).HasColumnName("Subject");
            this.Property(t => t.Note).HasColumnName("Note");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.Project).HasColumnName("Project");
            this.Property(t => t.Customer).HasColumnName("Customer");
            this.Property(t => t.TypeCode).HasColumnName("TypeCode");
            this.Property(t => t.CreatedBy).HasColumnName("CreatedBy");
            this.Property(t => t.Type).HasColumnName("Type");
        }
    }
}
